package com.liwbn.rbac.support;

import java.io.IOException;
import java.io.Serializable;

import org.codehaus.jackson.map.ObjectMapper;

/**
 * 失败信息返回
 * 
 * @author liwb 2016年3月2日 下午2:11:57
 */
public class JsonReInfo implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 7954413136990289810L;

    private Integer code;

    private Object message;

    public JsonReInfo() {

    }

    public JsonReInfo(Integer code, Object message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getMessage() {
        return message;
    }

    public void setMessage(Object message) {
        this.message = message;
    }

    @Override
    public String toString() {
        ObjectMapper om = new ObjectMapper();
        try {
            return om.writeValueAsString(this);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "{\"code\":111,\"message\":\"error\"}";
    }

}
